//
//  WBTableViewCell.m
//
//  Created by 周佳兴 on 16/3/9.
//  Copyright © 2016年 周佳兴. All rights reserved.
//

#import "WBTableViewCell.h"
#import "Masonry.h"
#import "UIColor+CL.h"
@implementation WBTableViewCell


- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.textLabel.font = [UIFont systemFontOfSize:15];
        self.textLabel.hidden = YES;
        self.imageView.hidden = YES;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
#pragma mark - cell的背景颜色改变成透明
        self.backgroundColor = [UIColor clearColor];
        _titleLabel = [[UILabel alloc] init];
        _centerImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:_titleLabel];
        [self.contentView addSubview:_centerImageView];
        [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.right.equalTo(self.contentView.mas_right);
            make.left.equalTo(_centerImageView.mas_right).offset(30/2);
            make.centerY.equalTo(self.contentView.mas_centerY);
            
        }];
        [_titleLabel sizeToFit];
        _titleLabel.font = [UIFont systemFontOfSize:34/2];
        _titleLabel.textColor = [UIColor colorWithHex:0x858585];
        [_centerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(20/2);
            make.centerY.equalTo(_titleLabel.mas_centerY);
        }];
        
    }
    return self;
}

+ (instancetype) cellAllocWithTableView:(UITableView *)tableView {
    
    WBTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([self class])];
    if (cell == nil) {
        cell = [[[self class] alloc] initWithStyle:0 reuseIdentifier:NSStringFromClass([self class])];
        //        cell.backgroundColor = [UIColor clearColor];
    }
    return cell;
}


- (void)awakeFromNib {
    // Initialization code
    [super awakeFromNib];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
